package org.nepu.scr.indexrate.converter.riskrate.equipmentrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentrisk.PowerB234;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class PowerB234Converter implements AttributeConverter<PowerB234, String> {
    @Override
    public String convertToDatabaseColumn(PowerB234 powerB234) {
        return JSONUtil.toJsonStr(powerB234);
    }

    @Override
    public PowerB234 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, PowerB234.class);
    }
}
